<%@ page language="java" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:choose>
<c:when test="${taskView.isSelect==true}">
<script type="text/javascript">
	<!--
	var nodeAndUserArr=new Array();
	var userIdArr;
	<c:forEach items="${taskView.childTaskNodeList}" var="listOne">
	userIdArr=new Array();
	    <c:if test="${ listOne.person!=null }">
	    	userIdArr.push({id:'${listOne.person.id}',name:'${listOne.person.name}'});
		</c:if>
		<c:forEach items="${listOne.personList}" var="personOne">
			userIdArr.push({id:'${personOne.id}',name:'${personOne.name}'});
		</c:forEach>
		nodeAndUserArr['${listOne.id}']=userIdArr;
	</c:forEach>
	$(document).ready(function(){
		$('#taskNodeOneId').change(function(){
				var nodeId=this.value;
				$('#taskAssign-useId').empty();
				$('#taskAssign-useId').addOption('','');
				if(nodeId!=''){
					var tmpUser=nodeAndUserArr[nodeId];
					if(tmpUser){
						if(tmpUser.length>0){
							$('#nextNodeUserIdBtn').hide();
						}else{
							$('#nextNodeUserIdBtn').show();
						}
						$.each(tmpUser,function(index,obj){
							$('#taskAssign-useId').addOption(obj.name,obj.id);
						});
					}else{
						//$('#taskAssign-useId').addOption('','');
					}
				}else{
					//$('#taskAssign-useId').addOption('','');
				}
		});
	});
	-->
</script>
<div style="height: 25px">
<li style="padding: 0;list-style: upper-roman;">
<select id="taskNodeOneId" name="taskNodeId" style="width:150px"  dataType="Require" msg="必选">
	<option value="">------------请选择-----------</option>
	<c:forEach items="${taskView.childTaskNodeList}" var="takkOne">
	<option value="${takkOne.id}">${takkOne.name}</option>
	</c:forEach>
</select>

<select name="userId" id="taskAssign-useId" style="width:180px" dataType="Require" msg="必选">
	<option value=""></option>
	<%--
    <s:iterator value="#request.taskView.childTaskNodeList">
    <s:if test="person!=null">
	<option value="<s:property value="person.id"/>"><s:property value="person.name"/></option>
	</s:if>
	<s:iterator value="personList">
	<option value="<s:property value="id"/>"><s:property value="name"/></option>
	</s:iterator>	
	</s:iterator>
	--%>
</select>
<button id="nextNodeUserIdBtn" type="button" onclick="selectMainPerson('taskAssign-useId')" style="margin-left: 5px;display: none;">选择人员</button>
</li>
</div>															
</c:when>
<c:otherwise>
<c:forEach items="${taskView.childTaskNodeList}" var="taskOne">
<li style="padding: 0;list-style: upper-roman;margin-top: 2px">
<select name="taskNodeId" style="width:150px">
	<option value="${taskOne.id}">${taskOne.name}</option>
</select>
<select name="userId" id="taskAssign-${taskOne.id}" style="width:180px" dataType="Require" msg="必选">
	<option value="${taskOne.person.id}">${taskOne.person.name}</option>
	<c:forEach items="${taskOne.personList}" var="personOne">
	<option value="${personOne.id}">${personOne.name}</option>
	</c:forEach>
</select>
<c:choose>
<c:when test="${taskOne.person!=null||(taskOne.secRole!=null&&taskOne.secRole!='')||(taskOne.assignHandlerClass!=null&&taskOne.assignHandlerClass!='')||(taskOne.personList!=null&&fn:length(taskOne.personList)>0)}">

</c:when>
<c:otherwise>
<button type="button" onclick="selectMainPerson('taskAssign-${taskOne.id}')" style="margin-left: 5px">选择人员</button>
</c:otherwise>
</c:choose>
<c:if test="${taskOne.secRole==null||taskOne.secRole==''}">

</c:if>

</li>
</c:forEach>
</c:otherwise>
</c:choose>
